<?php
require_once  __DIR__ . '/includes/authenticate.php';

?>

<!DOCTYPE html>
<html>
<head>
	<title>Add New Team</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<h4> Add New Team </h4>
<form class="form-horizontal">
	<div class="form-group">
		<label class="control-label col-sm-4" for="usr">Team Name: </label>
		<div class="col-sm-8">
			<input class="form-control" type="text" name="teamname" placeholder="Team Name" />	
			</div>
	</div>
	
	<div class="form-group">
		<div class="col-xs-offset-3 col-sm-offset-4 col-sm-3 col-md-offset-4 col-md-3">
		<button class="btn btn-success" id="submit" type="submit" name="submit">Add Team </button>
		<button type="reset" class="btn btn-danger ">Reset</button> 
		</div>
	</div>

</form>

<div id="responsemessage"></div>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>


<script type="text/javascript">

$("#submit").on("click", function(e) {
    postData = $(this.form).serialize();
    $.ajax({
        type: "POST",
        url: "./includes/handlers/admin_addnewteam_handler.php",
        data: postData,
        success: function(data) { 
            $("#responsemessage").html(data); 
        },
        error: function (xhr, status, error) {
        	$("#responsemessage").html(xhr.responseText); 
        }
      }); 
    e.preventDefault();
});  

</script>


</body>
</html>